<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Vanilla IF</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Vanilla IF' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../intern.html">Inter Modules</a></li><li><a href="index.html">final</a></li><li><a href="index.html#2">Chapter 2: Mechanism</a></li><li><b>Vanilla IF</b></li></ul></div>
<p class="purpose">Constructing the dictionary, command verb and action tables when the target language is not Inform 6 (where such things are made automatically).</p>

<ul class="toc"><li><a href="2-vi.html#SP1">&#167;1. Dictionary words</a></li><li><a href="2-vi.html#SP7">&#167;7. Actions table</a></li><li><a href="2-vi.html#SP8">&#167;8. Command grammar</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Dictionary words.</b>Compiling the table of dictionary words is not completely simple: they must
be sorted into alphabetical order, but do not present themselves that way.
</p>

<p class="commentary">So we provide the following functions, which a generator is not obliged to
make use of.
</p>

<p class="commentary">For each different dictionary word brought to our attention, we create one
of these:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">text</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">identifier</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">pluralise</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">meta</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">preplike</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">nounlike</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">verblike</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">verb_number</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">grammar_table_offset</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure vanilla_dword is accessed in 2/vf, 4/i6c2, 5/clt, 5/cfm and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>The following sorting function places dwords in alphabetical order:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">VanillaIF::compare_dwords</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">VanillaIF::compare_dwords</span></span>:<br/><a href="2-vi.html#SP5">&#167;5</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">const</span><span class="plain-syntax"> </span><span class="reserved-syntax">void</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ent1</span><span class="plain-syntax">, </span><span class="reserved-syntax">const</span><span class="plain-syntax"> </span><span class="reserved-syntax">void</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ent2</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">tx1</span><span class="plain-syntax"> = (*((</span><span class="reserved-syntax">const</span><span class="plain-syntax"> </span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax"> **) </span><span class="identifier-syntax">ent1</span><span class="plain-syntax">))-&gt;</span><span class="element-syntax">text</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">tx2</span><span class="plain-syntax"> = (*((</span><span class="reserved-syntax">const</span><span class="plain-syntax"> </span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax"> **) </span><span class="identifier-syntax">ent2</span><span class="plain-syntax">))-&gt;</span><span class="element-syntax">text</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">Str::cmp_insensitive</span><span class="plain-syntax">(</span><span class="identifier-syntax">tx1</span><span class="plain-syntax">, </span><span class="identifier-syntax">tx2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>We use a dictionary to ensure that each dword has exactly one such structure
created:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax"> *</span><span class="function-syntax">VanillaIF::find_dword</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">VanillaIF::find_dword</span></span>:<br/><a href="2-vi.html#SP4">&#167;4</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">pluralise</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">PUT_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">, </span><span class="identifier-syntax">Characters::tolower</span><span class="plain-syntax">(</span><span class="identifier-syntax">Str::get</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">)));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::get_last_char</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">) == </span><span class="character-syntax">'/'</span><span class="plain-syntax">) </span><span class="identifier-syntax">Str::delete_last_character</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax"> *</span><span class="identifier-syntax">dw</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Dictionaries::find</span><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">dword_dictionary</span><span class="plain-syntax">, </span><span class="identifier-syntax">K</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">dw</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Dictionaries::read_value</span><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">dword_dictionary</span><span class="plain-syntax">, </span><span class="identifier-syntax">K</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pluralise</span><span class="plain-syntax">) </span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">pluralise</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">dw</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">text</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">identifier</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">identifier</span><span class="plain-syntax">, </span><span class="string-syntax">"i7_dword_%d"</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">dword_count</span><span class="plain-syntax">++);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">pluralise</span><span class="plain-syntax"> = </span><span class="identifier-syntax">pluralise</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">meta</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">preplike</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">nounlike</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">verblike</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">verb_number</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">grammar_table_offset</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ADD_TO_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">dw</span><span class="plain-syntax">, </span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">words</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Dictionaries::create</span><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">dword_dictionary</span><span class="plain-syntax">, </span><span class="identifier-syntax">K</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Dictionaries::write_value</span><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">dword_dictionary</span><span class="plain-syntax">, </span><span class="identifier-syntax">K</span><span class="plain-syntax">, </span><span class="identifier-syntax">dw</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">dw</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>These linguistic categories are very crudely applied. The main thing to note
is that the same word can be in any combination of the three, except that it
cannot be in none of them.
</p>

<p class="commentary">If a generator wants to register a dword with us, it must call one of these:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax"> *</span><span class="function-syntax">VanillaIF::text_to_noun_dword</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">VanillaIF::text_to_noun_dword</span></span>:<br/>C Literals - <a href="5-clt.html#SP10">&#167;10</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">pluralise</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax"> *</span><span class="identifier-syntax">dw</span><span class="plain-syntax"> = </span><a href="2-vi.html#SP3" class="function-link"><span class="function-syntax">VanillaIF::find_dword</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">pluralise</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">nounlike</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">dw</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax"> *</span><span class="function-syntax">VanillaIF::text_to_prep_dword</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">VanillaIF::text_to_prep_dword</span></span>:<br/><a href="2-vi.html#SP8_2_2_3">&#167;8.2.2.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">pluralise</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax"> *</span><span class="identifier-syntax">dw</span><span class="plain-syntax"> = </span><a href="2-vi.html#SP3" class="function-link"><span class="function-syntax">VanillaIF::find_dword</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">pluralise</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">preplike</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">dw</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax"> *</span><span class="function-syntax">VanillaIF::text_to_verb_dword</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">VanillaIF::text_to_verb_dword</span></span>:<br/><a href="2-vi.html#SP8_2_1">&#167;8.2.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">verbnum</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax"> *</span><span class="identifier-syntax">dw</span><span class="plain-syntax"> = </span><a href="2-vi.html#SP3" class="function-link"><span class="function-syntax">VanillaIF::find_dword</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">verblike</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">verb_number</span><span class="plain-syntax"> = </span><span class="identifier-syntax">verbnum</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">dw</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>And this function then compiles the <span class="extract"><span class="extract-syntax">#dictionary_table</span></span> array, which is
really a concatenation of many arrays: a single word holding the length
and then one mini-array for each dword, presented in alphabetical order.
</p>

<p class="commentary">For the format of dictionary word arrays, see the Inform 6 Technical Manual.
(This is the later Glulx format, not the earlier Z-machine format.)
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">VanillaIF::compile_dictionary_table</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">VanillaIF::compile_dictionary_table</span></span>:<br/>Final C - <a href="5-fnc.html#SP6">&#167;6</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">dictlen</span><span class="plain-syntax"> = </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">dword_count</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-vi.html#SP5_1" class="named-paragraph-link"><span class="named-paragraph">Compile the dictionary length</span><span class="named-paragraph-number">5.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dictlen</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax"> **</span><span class="identifier-syntax">sorted</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax"> **)</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">Memory::calloc</span><span class="plain-syntax">(</span><span class="identifier-syntax">dictlen</span><span class="plain-syntax">, </span><span class="reserved-syntax">sizeof</span><span class="plain-syntax">(</span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax"> *), </span><span class="constant-syntax">CODE_GENERATION_MREASON</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax"> *</span><span class="identifier-syntax">dw</span><span class="plain-syntax">; </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">dw</span><span class="plain-syntax">, </span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">words</span><span class="plain-syntax">) </span><span class="identifier-syntax">sorted</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">++] = </span><span class="identifier-syntax">dw</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">qsort</span><span class="plain-syntax">(</span><span class="identifier-syntax">sorted</span><span class="plain-syntax">, (</span><span class="identifier-syntax">size_t</span><span class="plain-syntax">) </span><span class="identifier-syntax">LinkedLists::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">words</span><span class="plain-syntax">), </span><span class="reserved-syntax">sizeof</span><span class="plain-syntax">(</span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax"> *),</span>
<span class="plain-syntax">            </span><a href="2-vi.html#SP2" class="function-link"><span class="function-syntax">VanillaIF::compare_dwords</span></a><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">dictlen</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) </span><span class="named-paragraph-container code-font"><a href="2-vi.html#SP5_2" class="named-paragraph-link"><span class="named-paragraph">Compile an array for this dword</span><span class="named-paragraph-number">5.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Memory::I7_free</span><span class="plain-syntax">(</span><span class="identifier-syntax">sorted</span><span class="plain-syntax">, </span><span class="constant-syntax">CODE_GENERATION_MREASON</span><span class="plain-syntax">, </span><span class="identifier-syntax">dictlen</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5_1" class="paragraph-anchor"></a><b>&#167;5.1. </b>In effect, this is a 1-word word array, but we make it as a 4-byte byte array
instead so that we are not concatenating arrays with different formats; this is
just in case some generators are opting to align word arrays in memory.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Compile the dictionary length</span><span class="named-paragraph-number">5.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::begin_array</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"#dictionary_table"</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="constant-syntax">BYTE_ARRAY_FORMAT</span><span class="plain-syntax">, -1, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP6" class="function-link"><span class="function-syntax">VanillaIF::byte_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP6" class="function-link"><span class="function-syntax">VanillaIF::byte_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, ((</span><span class="identifier-syntax">dictlen</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">0x00FF0000</span><span class="plain-syntax">) &gt;&gt; </span><span class="constant-syntax">16</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP6" class="function-link"><span class="function-syntax">VanillaIF::byte_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, ((</span><span class="identifier-syntax">dictlen</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">0x0000FF00</span><span class="plain-syntax">) &gt;&gt; </span><span class="constant-syntax">8</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP6" class="function-link"><span class="function-syntax">VanillaIF::byte_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, (</span><span class="identifier-syntax">dictlen</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">0x000000FF</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::end_array</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">BYTE_ARRAY_FORMAT</span><span class="plain-syntax">, -1, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vi.html#SP5">&#167;5</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_2" class="paragraph-anchor"></a><b>&#167;5.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Compile an array for this dword</span><span class="named-paragraph-number">5.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">dw</span><span class="plain-syntax"> = </span><span class="identifier-syntax">sorted</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">];</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::begin_array</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">sorted</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">]-&gt;</span><span class="element-syntax">identifier</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="constant-syntax">BYTE_ARRAY_FORMAT</span><span class="plain-syntax">, -1, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP6" class="function-link"><span class="function-syntax">VanillaIF::byte_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">0x60</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP6" class="function-link"><span class="function-syntax">VanillaIF::byte_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP6" class="function-link"><span class="function-syntax">VanillaIF::byte_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP6" class="function-link"><span class="function-syntax">VanillaIF::byte_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;gen-&gt;</span><span class="element-syntax">dictionary_resolution</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">text</span><span class="plain-syntax">)) </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) </span><span class="identifier-syntax">Str::get_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">text</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP6" class="function-link"><span class="function-syntax">VanillaIF::byte_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, (((</span><span class="reserved-syntax">unsigned</span><span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax">)</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">0xFF000000</span><span class="plain-syntax">) &gt;&gt; </span><span class="constant-syntax">24</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP6" class="function-link"><span class="function-syntax">VanillaIF::byte_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, ((</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">0x00FF0000</span><span class="plain-syntax">) &gt;&gt; </span><span class="constant-syntax">16</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP6" class="function-link"><span class="function-syntax">VanillaIF::byte_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, ((</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">0x0000FF00</span><span class="plain-syntax">) &gt;&gt; </span><span class="constant-syntax">8</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP6" class="function-link"><span class="function-syntax">VanillaIF::byte_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &amp; </span><span class="constant-syntax">0x000000FF</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">f</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">verblike</span><span class="plain-syntax">) </span><span class="identifier-syntax">f</span><span class="plain-syntax"> += </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">meta</span><span class="plain-syntax">) </span><span class="identifier-syntax">f</span><span class="plain-syntax"> += </span><span class="constant-syntax">2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">pluralise</span><span class="plain-syntax">) </span><span class="identifier-syntax">f</span><span class="plain-syntax"> += </span><span class="constant-syntax">4</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">preplike</span><span class="plain-syntax">) </span><span class="identifier-syntax">f</span><span class="plain-syntax"> += </span><span class="constant-syntax">8</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">nounlike</span><span class="plain-syntax">) </span><span class="identifier-syntax">f</span><span class="plain-syntax"> += </span><span class="constant-syntax">128</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP6" class="function-link"><span class="function-syntax">VanillaIF::byte_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">f</span><span class="plain-syntax">/256);</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP6" class="function-link"><span class="function-syntax">VanillaIF::byte_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">f</span><span class="plain-syntax">%256);</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP6" class="function-link"><span class="function-syntax">VanillaIF::byte_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, (</span><span class="constant-syntax">0xFFFF</span><span class="plain-syntax"> - </span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">verb_number</span><span class="plain-syntax">)/256);</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP6" class="function-link"><span class="function-syntax">VanillaIF::byte_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, (</span><span class="constant-syntax">0xFFFF</span><span class="plain-syntax"> - </span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">verb_number</span><span class="plain-syntax">)%256);</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP6" class="function-link"><span class="function-syntax">VanillaIF::byte_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP6" class="function-link"><span class="function-syntax">VanillaIF::byte_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP6" class="function-link"><span class="function-syntax">VanillaIF::byte_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP6" class="function-link"><span class="function-syntax">VanillaIF::byte_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::end_array</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">BYTE_ARRAY_FORMAT</span><span class="plain-syntax">, -1, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vi.html#SP5">&#167;5</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">VanillaIF::byte_entry</span><button class="popup" onclick="togglePopup('usagePopup7')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup7">Usage of <span class="code-font"><span class="function-syntax">VanillaIF::byte_entry</span></span>:<br/><a href="2-vi.html#SP5_1">&#167;5.1</a>, <a href="2-vi.html#SP5_2">&#167;5.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">N</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="string-syntax">"%d"</span><span class="plain-syntax">, </span><span class="identifier-syntax">N</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::array_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="constant-syntax">BYTE_ARRAY_FORMAT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. Actions table.</b>We also need to make a metadata table called the <span class="extract"><span class="extract-syntax">#actions_table</span></span> which
gives, for each (true) action, a function to carry it out. The name of this
function is always given with a <span class="extract"><span class="extract-syntax">Sub</span></span> suffix: this once stood for subroutine,
and shows just how far back into the history of Inform 1 this all goes.
</p>

<p class="commentary">(It is the absence of such a function which makes a fake action fake.)
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">VanillaIF::compile_actions_table</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">VanillaIF::compile_actions_table</span></span>:<br/>Final C - <a href="5-fnc.html#SP6">&#167;6</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::begin_array</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"#actions_table"</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="constant-syntax">TABLE_ARRAY_FORMAT</span><span class="plain-syntax">, -1, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">an</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">an</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">actions</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">O</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">O</span><span class="plain-syntax">, </span><span class="string-syntax">"%SSub"</span><span class="plain-syntax">, </span><span class="identifier-syntax">an</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">M</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="2-cg2.html#SP16" class="function-link"><span class="function-syntax">Generators::mangle</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">M</span><span class="plain-syntax">, </span><span class="identifier-syntax">O</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::array_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">M</span><span class="plain-syntax">, </span><span class="constant-syntax">TABLE_ARRAY_FORMAT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">O</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">M</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::end_array</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">TABLE_ARRAY_FORMAT</span><span class="plain-syntax">, -1, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. Command grammar.</b>This is not the place to specify what an Inform 6 grammar table looks like:
again, see the I6 Technical Manual.
</p>

<p class="commentary">This limit is much, much larger than we need:
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">MAX_LINES_IN_VANILLA_GRAMMAR</span><span class="plain-syntax"> </span><span class="constant-syntax">256</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">VanillaIF::verb_grammar</span><button class="popup" onclick="togglePopup('usagePopup9')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup9">Usage of <span class="code-font"><span class="function-syntax">VanillaIF::verb_grammar</span></span>:<br/>C Memory Model - <a href="5-cmm.html#SP4_1">&#167;4.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generator</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gtr</span><span class="plain-syntax">, </span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">array_s</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax"> = </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">from</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">line_count</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">line_actions</span><span class="plain-syntax">[</span><span class="constant-syntax">MAX_LINES_IN_VANILLA_GRAMMAR</span><span class="plain-syntax">];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">line_reverse</span><span class="plain-syntax">[</span><span class="constant-syntax">MAX_LINES_IN_VANILLA_GRAMMAR</span><span class="plain-syntax">];</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-vi.html#SP8_1" class="named-paragraph-link"><span class="named-paragraph">Find the resulting actions and reversal states for each grammar line</span><span class="named-paragraph-number">8.1</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-vi.html#SP8_2" class="named-paragraph-link"><span class="named-paragraph">Add a record for this grammar to the table</span><span class="named-paragraph-number">8.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP8_1" class="paragraph-anchor"></a><b>&#167;8.1. </b>So the grammar is currently a list of values at the Inter node <span class="extract"><span class="extract-syntax">P</span></span>. The
first few terms in the list give the verb command words (TAKE, GET, say);
then come a series of 1 or more "grammar lines", each of which begins with
a <span class="extract"><span class="extract-syntax">VERB_DIRECTIVE_DIVIDER</span></span> symbol. A line ends with <span class="extract"><span class="extract-syntax">VERB_DIRECTIVE_RESULT</span></span>
followed by a token indicating the action resulting from the line; the
<span class="extract"><span class="extract-syntax">VERB_DIRECTIVE_REVERSE</span></span> token means that the action should be taken with
its nouns exchanged.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Find the resulting actions and reversal states for each grammar line</span><span class="named-paragraph-number">8.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">lines</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">extent</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ConstantInstruction::list_len</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">extent</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><a href="2-vi.html#SP9" class="function-link"><span class="function-syntax">VanillaIF::get_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">ConstantInstruction::list_entry</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_DIVIDER"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">lines</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">MAX_LINES_IN_VANILLA_GRAMMAR</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"too many lines in grammar"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">line_reverse</span><span class="plain-syntax">[</span><span class="identifier-syntax">lines</span><span class="plain-syntax">] = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">line_actions</span><span class="plain-syntax">[</span><span class="identifier-syntax">lines</span><span class="plain-syntax">] = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">lines</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_RESULT"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">line_actions</span><span class="plain-syntax">[</span><span class="identifier-syntax">lines</span><span class="plain-syntax">-1] =</span>
<span class="plain-syntax">                    </span><a href="2-vi.html#SP9" class="function-link"><span class="function-syntax">VanillaIF::get_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">ConstantInstruction::list_entry</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">+1));</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_REVERSE"</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">line_reverse</span><span class="plain-syntax">[</span><span class="identifier-syntax">lines</span><span class="plain-syntax">-1] = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">line_count</span><span class="plain-syntax"> = </span><span class="identifier-syntax">lines</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vi.html#SP8">&#167;8</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_2" class="paragraph-anchor"></a><b>&#167;8.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Add a record for this grammar to the table</span><span class="named-paragraph-number">8.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">verbnum</span><span class="plain-syntax"> = </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">verb_count</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">address</span><span class="plain-syntax"> = </span><span class="identifier-syntax">LinkedLists::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">verb_grammar</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_byte</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">line_count</span><span class="plain-syntax">); </span><span class="comment-syntax"> no grammar lines</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">reading_command_verbs</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">, </span><span class="identifier-syntax">synonyms</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">line_started</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">filter</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NOT_APPLICABLE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">lines</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">extent</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ConstantInstruction::list_len</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">extent</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inter_pair</span><span class="plain-syntax"> </span><span class="identifier-syntax">val</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ConstantInstruction::list_entry</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">reading_command_verbs</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="2-vi.html#SP8_2_1" class="named-paragraph-link"><span class="named-paragraph">Read this as a command verb</span><span class="named-paragraph-number">8.2.1</span></a></span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="named-paragraph-container code-font"><a href="2-vi.html#SP8_2_2" class="named-paragraph-link"><span class="named-paragraph">Read this as part of a grammar line</span><span class="named-paragraph-number">8.2.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-vi.html#SP8_2_3" class="named-paragraph-link"><span class="named-paragraph">Close any grammar line record we have already started writing</span><span class="named-paragraph-number">8.2.3</span></a></span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vi.html#SP8">&#167;8</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_2_1" class="paragraph-anchor"></a><b>&#167;8.2.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Read this as a command verb</span><span class="named-paragraph-number">8.2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">InterValuePairs::is_dword</span><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">glob_text</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InterValuePairs::to_dictionary_word</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">val</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax"> *</span><span class="identifier-syntax">dw</span><span class="plain-syntax"> = </span><a href="2-vi.html#SP4" class="function-link"><span class="function-syntax">VanillaIF::text_to_verb_dword</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">glob_text</span><span class="plain-syntax">, </span><span class="identifier-syntax">verbnum</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-vi.html#SP10" class="function-link"><span class="function-syntax">VanillaIF::is_verb_meta</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">)) </span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">meta</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">synonyms</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">synonyms</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="identifier-syntax">ADD_TO_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">dw</span><span class="plain-syntax">, </span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">verbs</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">grammar_table_offset</span><span class="plain-syntax"> = </span><span class="identifier-syntax">address</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><a href="2-vi.html#SP9" class="function-link"><span class="function-syntax">VanillaIF::get_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">val</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">S</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_DIVIDER"</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">reading_command_verbs</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">--;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vi.html#SP8_2">&#167;8.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_2_2" class="paragraph-anchor"></a><b>&#167;8.2.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Read this as part of a grammar line</span><span class="named-paragraph-number">8.2.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">token_metadata</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-vi.html#SP8_2_2_1" class="named-paragraph-link"><span class="named-paragraph">Add the slash before and slash after bits to token_metadata</span><span class="named-paragraph-number">8.2.2.1</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><a href="2-vi.html#SP9" class="function-link"><span class="function-syntax">VanillaIF::get_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">val</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="2-vi.html#SP8_2_2_2" class="named-paragraph-link"><span class="named-paragraph">Read this symbol name as part of a grammar line</span><span class="named-paragraph-number">8.2.2.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">InterValuePairs::is_dword</span><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="2-vi.html#SP8_2_2_3" class="named-paragraph-link"><span class="named-paragraph">Read this dictionary word as part of a grammar line</span><span class="named-paragraph-number">8.2.2.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vi.html#SP8_2">&#167;8.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_2_2_1" class="paragraph-anchor"></a><b>&#167;8.2.2.1. </b>Was the previous token a slash? How about the next? (This is for command grammar
like <span class="extract"><span class="extract-syntax">'fish' / 'fowl' / 'chalk'</span></span>, where <span class="extract"><span class="extract-syntax">'fish'</span></span> has a slash after but not before,
<span class="extract"><span class="extract-syntax">'fowl'</span></span> has both, and <span class="extract"><span class="extract-syntax">'chalk'</span></span> before but not after.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Add the slash before and slash after bits to token_metadata</span><span class="named-paragraph-number">8.2.2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S_before</span><span class="plain-syntax"> = </span><a href="2-vi.html#SP9" class="function-link"><span class="function-syntax">VanillaIF::get_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">ConstantInstruction::list_entry</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">-1));</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">S_before</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S_before</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_SLASH"</span><span class="plain-syntax">)))</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">token_metadata</span><span class="plain-syntax"> += </span><span class="constant-syntax">0x10</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax">+1 &lt; </span><span class="identifier-syntax">extent</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S_after</span><span class="plain-syntax"> = </span><a href="2-vi.html#SP9" class="function-link"><span class="function-syntax">VanillaIF::get_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">ConstantInstruction::list_entry</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">+1));</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">S_after</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S_after</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_SLASH"</span><span class="plain-syntax">)))</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">token_metadata</span><span class="plain-syntax"> += </span><span class="constant-syntax">0x20</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vi.html#SP8_2_2">&#167;8.2.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_2_2_2" class="paragraph-anchor"></a><b>&#167;8.2.2.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Read this symbol name as part of a grammar line</span><span class="named-paragraph-number">8.2.2.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_SLASH"</span><span class="plain-syntax">)) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_REVERSE"</span><span class="plain-syntax">)) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_DIVIDER"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="2-vi.html#SP8_2_3" class="named-paragraph-link"><span class="named-paragraph">Close any grammar line record we have already started writing</span><span class="named-paragraph-number">8.2.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="2-vi.html#SP8_2_2_2_1" class="named-paragraph-link"><span class="named-paragraph">Start writing a record for a new grammar line</span><span class="named-paragraph-number">8.2.2.2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">lines</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">line_started</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_RESULT"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">i</span><span class="plain-syntax">++; </span><span class="comment-syntax"> Skip the result action</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-vi.html#SP8_2_2_2_2" class="named-paragraph-link"><span class="named-paragraph">Handle the 10 built-in tokens</span><span class="named-paragraph-number">8.2.2.2.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-vi.html#SP8_2_2_2_3" class="named-paragraph-link"><span class="named-paragraph">Handle a noun filter, a scope filter or similar</span><span class="named-paragraph-number">8.2.2.2.3</span></a></span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vi.html#SP8_2_2">&#167;8.2.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_2_2_2_1" class="paragraph-anchor"></a><b>&#167;8.2.2.2.1. </b>This is the header block at the beginning of a new grammar line in the table,
which occupies 3 bytes: a short word giving the resulting action, and a flag
for reversal. (Happily, we worked these out in the first pass through earlier.)
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Start writing a record for a new grammar line</span><span class="named-paragraph-number">8.2.2.2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">NT</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP16" class="function-link"><span class="function-syntax">Generators::mangle</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">NT</span><span class="plain-syntax">, </span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">line_actions</span><span class="plain-syntax">[</span><span class="identifier-syntax">lines</span><span class="plain-syntax">]));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">B</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP12" class="function-link"><span class="function-syntax">Generators::word_to_byte</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="identifier-syntax">NT</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP12" class="function-link"><span class="function-syntax">Generators::word_to_byte</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">B</span><span class="plain-syntax">, </span><span class="identifier-syntax">NT</span><span class="plain-syntax">, </span><span class="constant-syntax">3</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_byte_textual</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">A</span><span class="plain-syntax">); </span><span class="comment-syntax"> action (big end)</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_byte_textual</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">B</span><span class="plain-syntax">); </span><span class="comment-syntax"> action (lil end)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">B</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">NT</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">line_reverse</span><span class="plain-syntax">[</span><span class="identifier-syntax">lines</span><span class="plain-syntax">])</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_byte</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_byte</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vi.html#SP8_2_2_2">&#167;8.2.2.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_2_2_2_2" class="paragraph-anchor"></a><b>&#167;8.2.2.2.2. </b>That 3-byte header is then followed by a list of 5-byte token blocks.
The opening byte gives some metadata bits, and then there's a word.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Handle the 10 built-in tokens</span><span class="named-paragraph-number">8.2.2.2.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_NOUN"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_byte</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax"> + </span><span class="identifier-syntax">token_metadata</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_word</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_HELD"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_byte</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax"> + </span><span class="identifier-syntax">token_metadata</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_word</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_MULTI"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_byte</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax"> + </span><span class="identifier-syntax">token_metadata</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_word</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_MULTIHELD"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_byte</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax"> + </span><span class="identifier-syntax">token_metadata</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_word</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">3</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_MULTIEXCEPT"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_byte</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax"> + </span><span class="identifier-syntax">token_metadata</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_word</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">4</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_MULTIINSIDE"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_byte</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax"> + </span><span class="identifier-syntax">token_metadata</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_word</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">5</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_CREATURE"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_byte</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax"> + </span><span class="identifier-syntax">token_metadata</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_word</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">6</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_SPECIAL"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_byte</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax"> + </span><span class="identifier-syntax">token_metadata</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_word</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">7</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_NUMBER"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_byte</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax"> + </span><span class="identifier-syntax">token_metadata</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_word</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">8</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_TOPIC"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_byte</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax"> + </span><span class="identifier-syntax">token_metadata</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_word</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">9</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vi.html#SP8_2_2_2">&#167;8.2.2.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_2_2_2_3" class="paragraph-anchor"></a><b>&#167;8.2.2.2.3. </b>Again, five bytes: one byte metadata, one word value.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Handle a noun filter, a scope filter or similar</span><span class="named-paragraph-number">8.2.2.2.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_NOUN_FILTER"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">filter</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">; </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_SCOPE_FILTER"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">filter</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">; </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">bc</span><span class="plain-syntax"> = </span><span class="constant-syntax">0x86</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">filter</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="identifier-syntax">bc</span><span class="plain-syntax"> = </span><span class="constant-syntax">0x85</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">filter</span><span class="plain-syntax"> == </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">)  </span><span class="identifier-syntax">bc</span><span class="plain-syntax"> = </span><span class="constant-syntax">0x83</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_byte</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">bc</span><span class="plain-syntax"> + </span><span class="identifier-syntax">token_metadata</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">MG</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP16" class="function-link"><span class="function-syntax">Generators::mangle</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">MG</span><span class="plain-syntax">, </span><span class="identifier-syntax">InterSymbol::trans</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_word_textual</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">MG</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">MG</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">filter</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NOT_APPLICABLE</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vi.html#SP8_2_2_2">&#167;8.2.2.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_2_2_3" class="paragraph-anchor"></a><b>&#167;8.2.2.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Read this dictionary word as part of a grammar line</span><span class="named-paragraph-number">8.2.2.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">glob_text</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InterValuePairs::to_dictionary_word</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">val</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax"> *</span><span class="identifier-syntax">dw</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP4" class="function-link"><span class="function-syntax">VanillaIF::text_to_prep_dword</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">glob_text</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">InterValuePairs::is_plural_dword</span><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">))?</span><span class="identifier-syntax">TRUE:FALSE</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_byte</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">0x42</span><span class="plain-syntax"> + </span><span class="identifier-syntax">token_metadata</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">MG</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP16" class="function-link"><span class="function-syntax">Generators::mangle</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">MG</span><span class="plain-syntax">, </span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">identifier</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_word_textual</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">MG</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">MG</span><span class="plain-syntax">)</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vi.html#SP8_2_2">&#167;8.2.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8_2_3" class="paragraph-anchor"></a><b>&#167;8.2.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Close any grammar line record we have already started writing</span><span class="named-paragraph-number">8.2.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">line_started</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="2-cg2.html#SP16" class="function-link"><span class="function-syntax">Generators::mangle</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"ENDIT_TOKEN"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_byte_textual</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">T</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-vi.html#SP8_2">&#167;8.2</a> and <a href="2-vi.html#SP8_2_2_2">&#167;8.2.2.2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="function-syntax">VanillaIF::get_symbol</span><button class="popup" onclick="togglePopup('usagePopup10')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup10">Usage of <span class="code-font"><span class="function-syntax">VanillaIF::get_symbol</span></span>:<br/><a href="2-vi.html#SP8_1">&#167;8.1</a>, <a href="2-vi.html#SP8_2_1">&#167;8.2.1</a>, <a href="2-vi.html#SP8_2_2">&#167;8.2.2</a>, <a href="2-vi.html#SP8_2_2_1">&#167;8.2.2.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_pair</span><span class="plain-syntax"> </span><span class="identifier-syntax">val</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">InterValuePairs::is_symbolic</span><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InterValuePairs::to_symbol_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"bad symbol in grammar token data"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">S</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. </b>This looks at the opening of the verb grammar to check for the keyword <span class="extract"><span class="extract-syntax">meta</span></span>:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">VanillaIF::is_verb_meta</span><button class="popup" onclick="togglePopup('usagePopup11')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup11">Usage of <span class="code-font"><span class="function-syntax">VanillaIF::is_verb_meta</span></span>:<br/><a href="2-vi.html#SP8_2_1">&#167;8.2.1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_pair</span><span class="plain-syntax"> </span><span class="identifier-syntax">val</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ConstantInstruction::list_entry</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">InterValuePairs::is_symbolic</span><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">A</span><span class="plain-syntax"> = </span><span class="identifier-syntax">InterValuePairs::to_symbol_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">A</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">InterSymbol::identifier</span><span class="plain-syntax">(</span><span class="identifier-syntax">A</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"VERB_DIRECTIVE_META"</span><span class="plain-syntax">)))</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. </b>Okay then. So the above functions called the following to insert either
bytes or words into the growing grammar table. But Vanilla doesn't support
arrays with a mixture of bytes and words &mdash; its entries should all be of
the same format. So we will break the words down into a sequence of 4 bytes,
and have only a <span class="extract"><span class="extract-syntax">BYTE_ARRAY_FORMAT</span></span> array in the end.
</p>

<p class="commentary">The above supplied some entries numerically, and others textually, so we
need four functions in all.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">VanillaIF::grammar_byte</span><button class="popup" onclick="togglePopup('usagePopup12')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup12">Usage of <span class="code-font"><span class="function-syntax">VanillaIF::grammar_byte</span></span>:<br/><a href="2-vi.html#SP8_2">&#167;8.2</a>, <a href="2-vi.html#SP8_2_2_2_1">&#167;8.2.2.2.1</a>, <a href="2-vi.html#SP8_2_2_2_2">&#167;8.2.2.2.2</a>, <a href="2-vi.html#SP8_2_2_2_3">&#167;8.2.2.2.3</a>, <a href="2-vi.html#SP8_2_2_3">&#167;8.2.2.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">N</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">NT</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">NT</span><span class="plain-syntax">, </span><span class="string-syntax">"%d"</span><span class="plain-syntax">, </span><span class="identifier-syntax">N</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_byte_textual</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">NT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">NT</span><span class="plain-syntax">)</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">VanillaIF::grammar_word</span><button class="popup" onclick="togglePopup('usagePopup13')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup13">Usage of <span class="code-font"><span class="function-syntax">VanillaIF::grammar_word</span></span>:<br/><a href="2-vi.html#SP8_2_2_2_2">&#167;8.2.2.2.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">N</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">NT</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">NT</span><span class="plain-syntax">, </span><span class="string-syntax">"%d"</span><span class="plain-syntax">, </span><span class="identifier-syntax">N</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_word_textual</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">NT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">NT</span><span class="plain-syntax">)</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">VanillaIF::grammar_word_textual</span><button class="popup" onclick="togglePopup('usagePopup14')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup14">Usage of <span class="code-font"><span class="function-syntax">VanillaIF::grammar_word_textual</span></span>:<br/><a href="2-vi.html#SP8_2_2_2_3">&#167;8.2.2.2.3</a>, <a href="2-vi.html#SP8_2_2_3">&#167;8.2.2.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">NT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">b</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">b</span><span class="plain-syntax">&lt;4; </span><span class="identifier-syntax">b</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">BT</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="2-cg2.html#SP12" class="function-link"><span class="function-syntax">Generators::word_to_byte</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">BT</span><span class="plain-syntax">, </span><span class="identifier-syntax">NT</span><span class="plain-syntax">, </span><span class="identifier-syntax">b</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-vi.html#SP11" class="function-link"><span class="function-syntax">VanillaIF::grammar_byte_textual</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">BT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">BT</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">VanillaIF::grammar_byte_textual</span><button class="popup" onclick="togglePopup('usagePopup15')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup15">Usage of <span class="code-font"><span class="function-syntax">VanillaIF::grammar_byte_textual</span></span>:<br/><a href="2-vi.html#SP8_2_2_2_1">&#167;8.2.2.2.1</a>, <a href="2-vi.html#SP8_2_3">&#167;8.2.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">NT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">NT</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">NT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ADD_TO_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">NT</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">verb_grammar</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP12" class="paragraph-anchor"></a><b>&#167;12. </b>Finally, then, the following outputs the table itself. In fact there need to
be two tables: first a table of addresses of each command verb's grammar table,
called <span class="extract"><span class="extract-syntax">#grammar_table</span></span>, and then each of those grammar tables in turn. I don't
think there is any reason they necessarily have to be contiguous in the way
they are here, but that's what Inform 6 always did, and we're imitating Inform 6.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">VanillaIF::compile_verb_table</span><button class="popup" onclick="togglePopup('usagePopup16')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup16">Usage of <span class="code-font"><span class="function-syntax">VanillaIF::compile_verb_table</span></span>:<br/>Final C - <a href="5-fnc.html#SP6">&#167;6</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">code_generation</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gen</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::begin_array</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"#grammar_table"</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="constant-syntax">TABLE_ARRAY_FORMAT</span><span class="plain-syntax">, -1, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax"> *</span><span class="identifier-syntax">dw</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">dw</span><span class="plain-syntax">, </span><span class="reserved-syntax">vanilla_dword</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">verbs</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">N</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="string-syntax">"("</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-cg2.html#SP16" class="function-link"><span class="function-syntax">Generators::mangle</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"#grammar_table_cont"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="string-syntax">"+%d)"</span><span class="plain-syntax">, </span><span class="identifier-syntax">dw</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">grammar_table_offset</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::array_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="constant-syntax">TABLE_ARRAY_FORMAT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">N</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::end_array</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">TABLE_ARRAY_FORMAT</span><span class="plain-syntax">, -1, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::begin_array</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"#grammar_table_cont"</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="constant-syntax">BYTE_ARRAY_FORMAT</span><span class="plain-syntax">, -1, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">entry</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">entry</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax">, </span><span class="identifier-syntax">gen</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">verb_grammar</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::array_entry</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="identifier-syntax">entry</span><span class="plain-syntax">, </span><span class="constant-syntax">BYTE_ARRAY_FORMAT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-cg2.html#SP10" class="function-link"><span class="function-syntax">Generators::end_array</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">gen</span><span class="plain-syntax">, </span><span class="constant-syntax">BYTE_ARRAY_FORMAT</span><span class="plain-syntax">, -1, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="2-vc2.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-fm.html">1</a></li><li class="progresscurrentchapter">2</li><li class="progresssection"><a href="2-cg.html">cg</a></li><li class="progresssection"><a href="2-cg2.html">cg2</a></li><li class="progresssection"><a href="2-vnl.html">vnl</a></li><li class="progresssection"><a href="2-vc.html">vc</a></li><li class="progresssection"><a href="2-vf.html">vf</a></li><li class="progresssection"><a href="2-vo.html">vo</a></li><li class="progresssection"><a href="2-vc2.html">vc2</a></li><li class="progresscurrent">vi</li><li class="progresschapter"><a href="3-fti.html">3</a></li><li class="progresschapter"><a href="4-fi6.html">4</a></li><li class="progresschapter"><a href="5-fnc.html">5</a></li><li class="progressnext"><a href="3-fti.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

